package rbm.modelado.datos.elementos.compuestos;

import java.util.Iterator;
import java.util.Set;

import modelado.datos.DatosDiscretosAbstracto;
import rbm.modelado.datos.elementos.BlockImpl;

import rbm.modelado.datos.elementos.interfaces.Block;
import rbm.modelado.datos.elementos.interfaces.BoardShape;
import rbm.modelado.datos.elementos.interfaces.PointShape;
import rbm.modelado.datos.elementos.interfaces.PuzzleFloor;


public class PuzzleNivelImpl extends DatosDiscretosAbstracto implements PuzzleFloor {
	
	private Integer nivel; 
	private BoardShape board;
	private Set<Block> blocks;
	
	private PointShape startCoord;
	private PointShape finishCoords;
	
	public PuzzleNivelImpl( Integer level , BoardShape b, Set<Block> blocks, PointShape start, PointShape finish)
	{
		nivel = level;
	    board = b;
	    this.blocks = blocks;
	    startCoord = start;
	    finishCoords = finish;
    }

/*
   public PlantaImpl( int x, int y )
   {
	   
	   board = new boolean[x][y];
	
	   boolean[][][] b = {{{true, true}}};
	   blocksShape = b;
	
	   int[] s = { 0, 0 };
	   startCoord = s;
	
	   int[] f = { 0, 0 };
	   finishCoords = f;
   }
*/



	public Block getBlock(int codigo) {
		boolean fin = false;
		BlockImpl b = null;
		Iterator<Block> it = blocks.iterator();
		while((it.hasNext())&& !fin){
			b = (BlockImpl) it.next();
			fin = b.getCodigo().equals(codigo);
		}
		if (b == null){
			throw new IllegalArgumentException();
		}
		return b;
	}
	
	
	public Set<Block> getBlocks() {
		return blocks;
	}
	

	public PointShape getCoordFinal() {
		return finishCoords;
	}
	

	public PointShape getCoordInic() {
		return startCoord;
	}
	

	public BoardShape getFloor() {
		return board;
	}

	public Integer getLevel() {
		return nivel;
	}

	@Override
	public Block getBlock(Integer codigo) {
		// TODO Auto-generated method stub
		return null;
	}

}
